package com.wuyanzu.shixicoderedo.common.threadlocal;

/** ThreadLocal holder，保证上下文线程安全 */
public final class RequestContextHolder {

    // ThreadLocal 保存 RequestContext
    private static final ThreadLocal<RequestContext> CTX = new ThreadLocal<>();

    private RequestContextHolder() {}

    // 设置
    public static void set(RequestContext ctx) { CTX.set(ctx); }

    // 获取
    public static RequestContext get() { return CTX.get(); }

    // 清理
    public static void clear() { CTX.remove(); }
}
